import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      title: '首页'
    }
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/Register.vue'),
    meta: {
      title: '注册'
    }
  },
  {
    path: '/home',
    name: 'home',
    meta: {
      title: '首页',
      isShow: true
    },
    component:()=>import('@/views/Home')
  },
  {
    path: '/dailylist',
    name: 'dailylist',
    meta: {
      title: '全部日志'
    },
    component:()=>import('@/views/DailyList')
  },
  { 
    path: '/dailydetail',
    name: 'dailydetail',
    meta: {
      title: '日志详情'
    },
    component:()=>import('@/views/DailyDetail')
  },
  {
    path: '/board',
    name: 'board',
    meta: {
      title: '宠物寄养',
      isShow: true
    },
    component:()=>import('@/views/Board')

  },
  {
    path: "/business/:b_id",
    name: "business",
    props: true,
    component: () => import("@/views/Business.vue")
  },
  {
    path: '/petreservation/:b_id/:b_name/:b_price',
    props: true,
    name: 'petreservation',
    meta: {
      title: '立即预定'
    },
    component: () => import('@/views/PetReservation.vue')
  },
  {
    path: '/contactAdd',
    name: 'contactAdd',
    meta: {
      title: '新增联系人',
    },
    component: ()=> import('@/views/ContactAdd.vue')
  },
  {
    path: '/contactList',
    name: 'contactList',
    meta: {
      title: '联系人列表',
    },
    component: ()=> import('@/views/ContactList.vue')
  },
  {
    path: '/order',
    name: 'order',
    meta: {
      title: '订单',
      isShow: true
    },
    component:()=>import('@/views/Order')

  },
  {
    path: '/mine',
    name: 'mine',
    meta:{
      title: '我的',
      isShow: true
    },
    component:()=>import('@/views/Mine')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
